package cn.cjp.m3d24;

public class aPerson {

    private String str1;

    public aPerson(String str1) {
        this.str1 = str1;
    }
//没覆盖重写前，返回地址值
/*
@Override
    public String toString() {
        return "aaaa";
    }
*/
    @Override
    public String toString() {
        return "toString{" +
                "str1='" + str1 + '\'' +
                '}';
        }

    //没覆盖前比较地址值
    @Override
    public boolean equals(Object obj) {

        //判断
        if(obj instanceof aPerson){
        //比较对象属性
    aPerson p = (aPerson) obj;
    return this.str1.equals(p.str1);
    }
        return false;
    }
}
